package br.ufrn.sipac.patrimonio.coletor.exception;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import br.ufrn.sipac.patrimonio.coletor.ComportamentoInesperadoActivity;
import br.ufrn.sipac.patrimonio.coletor.controller.MainController;

/**
 * Classe que lida com exceções de banco de dados.
 * 
 * @author Giuliana Silva Bezerra
 * 
 */
@SuppressWarnings("serial")
public class DatabaseException extends ColetorException {

	public DatabaseException(String message, Context context) {
		super(message);
		/** Tela de erro padrão. */
		MainController.setStacktrace(message);
		((Activity) context).finish();
		Intent intent = new Intent(context,
				ComportamentoInesperadoActivity.class);
		context.startActivity(intent);
	}
}
